package com.ssy.lingxi.contract.model.constant;

import java.util.Arrays;

/**
 * 合同付款阶段枚举
 * @author 伍将
 * @date 2021/2/7
 * @version 2.0.0
 */
public enum ContractPayStageEnum {

    ALL(0, "所有"),
    ADVANCE_PAYMENT(1, "合同预付款"),
    INTERIM_PAYMENT(2, "合同中期款"),
    BALANCE_PAYMENT(3, "合同尾款");

    private final Integer code;
    private final String message;

    ContractPayStageEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String getMessage(Integer code) {
        return Arrays.stream(ContractPayStageEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL).getMessage();
    }
}
